package com.qidian.mes.quality.service.impl;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Detect;
import com.qidian.mes.quality.mapper.DefectMapper;
import com.qidian.mes.quality.mapper.DetectMapper;
import com.qidian.mes.quality.service.DetectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author gfdycxy
 * @Company cxy
 * @Description
 * @Time 2024/10/17 19:15
 */
@Service
public class DetectServiceImpl implements DetectService {
    @Autowired
    private DetectMapper detectMapper;
    @Override
    public MESResult selectAllDetect() {
        return MESResult.success(detectMapper.selectAllDetect());
    }

    @Override
    public MESResult insert(Detect detect) {
        return detectMapper.insert(detect)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult updateById(Detect detect) {
        return detectMapper.updateById(detect)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult queryById(Long detectId) {
        return MESResult.success(detectMapper.queryById(detectId));
    }

    @Override
    public MESResult deleteById(String detectId) {
        return detectMapper.deleteById(detectId)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult deleteByIds(String[] detectId) {
        return MESResult.success(200,"ok",detectMapper.deleteByIds(detectId));
    }
}